#include <extend.h>

extern SYMPITEM __sympb, __sympe;
extern PDYNSYM pDynSymbols;

typedef void ( * REGFUNC )( PSYMBOL );

//---------------------------------------------------------------------------//

WORD _weed_eatr( REGFUNC pRegFunc )
{
   PSYMPITEM pSymTable = &__sympb;
   WORD wCount = 0, wLen, wItem;
   BYTE buffer[ 10 ];

   do
   {
      wLen = pSymTable->lSize / sizeof( SYMBOL );

      for( wItem = 0; wItem < wLen; wItem++ )
         if( pRegFunc )
            ( pRegFunc )( pSymTable->pSymbols + wItem );

      wCount += wLen;

   } while( ++pSymTable < &__sympe );

   return ( wCount > 500 ) ? 500: wCount;
}

//---------------------------------------------------------------------------//

PSYMBOL NewSymbol( LPSTR szName )
{
   PSYMBOL pSymbol = ( PSYMBOL ) _vmLock( _vmAlloc( sizeof( SYMBOL ) ) );

   _strcpy( pSymbol->szName, szName );

   return pSymbol;
}

//---------------------------------------------------------------------------//

CLIPPER Int()
{
   if( _isnum( 1 ) )
      _retnl( _parnl( 1 ) );
   else
      _retnl( 0 );
}

//---------------------------------------------------------------------------//
